package com.gxa.service.impl;

import com.gxa.pojo.Goods;
import com.gxa.pojo.GoodsClass;
import com.gxa.pojo.Pll;
import com.gxa.service.GoodsService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: zrf
 * Date: 2020/11/26 9:20
 * Description:
 * Version: V1.0
 */
@Service
public class GoodsServiceImpl implements GoodsService{
//    @Autowired(required = false)
//    private GoodsMapper goodsMapper;

    /**
     * 查询所有商品信息，按时间倒序
     *
     * @param
     * @return
     */
    @Override
    public List<Map> queryGoods() {

        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("goodsId",1);
        map1.put("goodsName","哈密瓜");
        map1.put("goodsPp","图片");
        map1.put("goodsPrice",20.0);
        map1.put("goodsCsort",200);
        map1.put("xnxl","500");

        map2.put("goodsId",2);
        map2.put("goodsName","西瓜");
        map2.put("goodsPp","图片");
        map2.put("goodsPrice",40.0);
        map2.put("goodsCsort",300);
        map2.put("xnxl","500");

        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }

    /**
     * 修改商品信息
     *
     * @param
     * @return
     */
    @Override
    public int updateGoods(Goods goods) {
        return 1;
    }
    /**
     * 删除商品信息
     *
     * @param
     * @return
     */
    @Override
    public int delGoods(int goodsId) {
        return 1;
    }

    /**
     * 商品加入回收站
     *
     * @param
     * @return
     */
    @Override
    public int hszGoods(Integer[] goodsId) {
        for(int i = 0;i<goodsId.length;i++){
            System.out.println(goodsId[i]);
        }
        return 1;
    }
    /**
     * 搜索商品信息
     *
     * @param
     * @return
     */
    @Override
    public List<Map> SelGoods(String goodscname, int number, String goodsCname) {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("goodsId",1);
        map1.put("goodsName","哈密瓜1");
        map1.put("goodsPp","图片1");
        map1.put("goodsPrice",20.0);
        map1.put("goodsCsort",200);
        map1.put("xnxl","500");

        map2.put("goodsId",2);
        map2.put("goodsName","西瓜1");
        map2.put("goodsPp","图片1");
        map2.put("goodsPrice",40.0);
        map2.put("goodsCsort",300);
        map2.put("xnxl","500");

        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }
    /**
     * 添加商品信息
     *
     * @param
     * @return
     */    @Override
    public int addGoods(Goods goods) {
        return 1;
    }
    /**
     * 查询商品回收站
     *
     * @param
     * @return
     */
    @Override
    public List<Map> queryGoodsUn() {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("goodsId",1);
        map1.put("goodsName","哈密瓜2");
        map1.put("goodsPrice",20.0);
        map1.put("number","12525");

        map2.put("goodsId",1);
        map2.put("goodsName","哈密瓜2");
        map2.put("goodsPrice",20.0);
        map2.put("number","12525");

        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }
    /**
     * 查询商品分类
     *
     * @param
     * @return
     */
    @Override
    public List<Map> queryGoodsClass() {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
       map1.put("goodsCid",1);
       map1.put("goodsCsort","sa115153");
       map1.put("goodsCname","水果类");
       map1.put("goodsCstatus",1);

        map2.put("goodsCid",2);
        map2.put("goodsCsort","sal65416841");
        map2.put("goodsCname","蔬菜类");
        map2.put("goodsCstatus",1);
        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }

    /**
     * 更改商品分类显示状态
     *
     * @param
     * @return
     */
    @Override
    public int updateGoodsClSt(int goodsCid) {
        return 1;
    }
    /**
     * 修改商品分类
     *
     * @param
     * @return
     */
    @Override
    public int updateGoodsClass(GoodsClass goodsClass) {
        return 1;
    }
    /**
     * 删除商品分类
     *
     * @param
     * @return
     */
    @Override
    public int delGoodsClass(int goodsCid) {
        return 1;
    }
    /**
     * 添加商品分类
     *
     * @param
     * @return
     */
    @Override
    public int addGoodsClass(GoodsClass goodsClass) {
        return 1;
    }
    /**
     * 商品标签
     *
     * @param
     * @return
     */
    @Override
    public List<Map> qureyPll() {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("pllId",1);
        map1.put("pllName","24小时包退");
        map1.put("pllDesc","收到货24小时内，商品质量问题可退货退款，逾期不予处理");
        map1.put("pllStatu",1);

        map2.put("pllId",2);
        map2.put("pllName","正平");
        map2.put("pllDesc","生态农业，专业种植，优质货源，产地直达");
        map2.put("pllStatu",1);
        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }
    /**
     * 更改商品标签使用状态
     *
     * @param
     * @return
     */
    @Override
    public int updatePllSt(int pllId) {
        return 1;
    }
    /**
     * 修改商品标签
     *
     * @param
     * @return
     */
    @Override
    public int updatePll(Pll pll) {
        return 1;
    }
    /**
     * 添加商品标签
     *
     * @param
     * @return
     */
    @Override
    public int addPll(Pll pll) {
        return 1;
    }
    /**
     * 商品评论
     *
     * @param
     * @return
     */
    @Override
    public List<Map> qureyPr() {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("prId",1);
        map1.put("userXname","a");
        map1.put("prComments","好吃不贵");
        map1.put("prRs",1);
        map1.put("prOs",1);
        map1.put("prCt","2020.10.11");

        map2.put("prId",2);
        map2.put("userXname","b");
        map2.put("prComments","好吃不贵ya");
        map2.put("prRs",1);
        map2.put("prStatus",1);
        map2.put("prOs","2020.10.12");
        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }

    /**
     * 搜索商品评论
     *
     * @param
     * @return
     */
    @Override
    public List<Map> selPr(String prComments) {
        //        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("prId",1);
        map1.put("userXname","d");
        map1.put("prComments","好吃不贵...");
        map1.put("prRs",1);
        map1.put("prOs",1);
        map1.put("prCt","2020.01.20");

        mapList.add(map1);
        return mapList;
    }
    /**
     * 删除商品评论
     *
     * @param
     * @return
     */
    @Override
    public int delPr(Integer[] prId) {
        return 1;
    }
    /**
     * 允许显示商品评论
     *
     * @param
     * @return
     */
    @Override
    public int updPr(Integer[] prId) {
        return 1;
    }
    /**
     * 禁止显示商品评论
     *
     * @param
     * @return
     */
    @Override
    public int updPrUn(Integer[] prId) {
        return 0;
    }
    /**
     * 显示隐藏的商品评论
     *
     * @param
     * @return
     */
    @Override
    public List<Map> qureyPrUn() {
        System.out.println("========");
//        List<Map> mapList = goodsMapper.queryGoods();
        List<Map> mapList = new ArrayList();
        Map map1 = new HashMap();
        Map map2= new HashMap();
        map1.put("prId",1);
        map1.put("userXname","a");
        map1.put("prComments","好吃不贵");
        map1.put("prRs",1);
        map1.put("prOs",0);
        map1.put("prCt","2020.10.11");

        map2.put("prId",2);
        map2.put("userXname","b");
        map2.put("prComments","好吃不贵ya");
        map2.put("prRs",1);
        map2.put("prStatus",0);
        map2.put("prOs","2020.10.12");
        mapList.add(map1);
        mapList.add(map2);
        return mapList;
    }

}
